package com.api;

import com.alibaba.fastjson.JSON;
import com.service.ReportStrService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.HashMap;
import java.util.Map;


@Controller
public class SearchlibController {
    @Autowired
    ReportStrService reportStrService;

    @ResponseBody
    @PostMapping("/api/searchlib")
    public String index(@RequestParam("strHash") String strHash, @RequestParam("str") String str) {
        new Thread(()->{reportStrService.compareStrWithReportStr(strHash, str);}).start();
        new Thread(()->{reportStrService.compareStrWithPublicStr(strHash, str);}).start();


        Map map = new HashMap<>();
        map.put("status",true);
        return JSON.toJSONString(map);
    }
}
